package com.miracle.main.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.miracle.basemvp.network.glide.GlideApp;
import com.miracle.main.R;
import com.miracle.main.module.mvp.entity.bean.FileItem;

import java.util.List;

/**
 * com.miracle.main.adapter
 * (c)2018 AIR Times Inc. All rights reserved.
 *
 *
 * @author WangJQ
 * @version 1.0
 * @date 2018/7/11 10:33
 * @see com.miracle.main.adapter
 */
public class FileListAdapter extends BaseMultiItemQuickAdapter<FileItem, BaseViewHolder> {
    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    public FileListAdapter(List<FileItem> data) {
        super(data);
        addItemType(FileItem.TYPE_TEXT, R.layout.cloud_item_file);
        addItemType(FileItem.TYPE_FOLDER, R.layout.cloud_item_folder);
        addItemType(FileItem.TYPE_IMG, R.layout.cloud_item_pic);
    }

    @Override
    protected void convert(BaseViewHolder helper, FileItem item) {
        switch (item.getItemType()) {
            case FileItem.TYPE_TEXT:
                break;
            case FileItem.TYPE_FOLDER:
                break;
            case FileItem.TYPE_IMG:
                ImageView imageView = helper.itemView.findViewById(R.id.iv);
                GlideApp.with(mContext).load(item.getPath()).into(imageView);

                break;
            default:
                break;
        }
    }
}
